<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>jQuery表单验证</title>
    <script src="jquery-3.6.0.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function(){
            $("form :input.required").each(function(){
                var $required = $("<strong class='star'>*</strong>");
                $(this).parent().append()
            })
        })
    </script>
</head>
<body>
    <form >
        <h3 align="center">用户注册</h3>
        <div class="dt">
            用户名：<input type="text" id="username" name="username" size=20 class="required"/>
        </div>
        <div class="dt">
            密码：<input type="password" id="pwd" name="pwd" size=20 class="required"/>
        </div>
        <div class="dt">
            电话：<input type="text" id="phone" name="phone" size=11 maxlength="11"/>
        </div>
        <div class="dt">
            地址：<input type="text" id="address" size="20" maxlength="20"/>
        </div>
        <div class="dt">
            <input type="submit" name="sub" value="注册" />
        </div>
    </form> 
</body>
</html>